package com.linkey.demo.services.test.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.linkey.demo.services.test.service.DataOriginalService;
import com.linkey.demo.services.test.dto.DataOriginalInsertDTO;
import com.linkey.demo.services.test.vo.DataOriginalVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.linkey.demo.services.test.dto.DataOriginalPageDTO;
import com.linkey.demo.services.test.vo.DataOriginalPageVO;

import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhujh
 * @since 2021-03-29
 */
@RestController
@RequestMapping("/test/dataOriginal")
@Api(tags = "test")
public class DataOriginalController {

    @Resource
    private DataOriginalService dataOriginalService;

    @ApiOperation(value = "DataOriginal插入")
    @ApiOperationSupport(order = 1)
    @PostMapping("/add")
    public void add(@RequestBody DataOriginalInsertDTO dataOriginalInsertDTO) {
        dataOriginalService.add(dataOriginalInsertDTO);
    }

    @ApiOperation(value = "DataOriginal更新")
    @ApiOperationSupport(order = 2)
    @PostMapping("/update")
    public void update(@RequestBody DataOriginalInsertDTO dataOriginalInsertDTO) {
        dataOriginalService.update(dataOriginalInsertDTO);
    }

    @ApiOperation(value = "根据id查找DataOriginal信息")
    @ApiOperationSupport(order = 3)
    @GetMapping("/get/{id}")
    public DataOriginalVO get(@PathVariable Long id) {
        return dataOriginalService.get(id);
    }


    @ApiOperation(value = "DataOriginal分页")
    @ApiOperationSupport(order = 4)
    @PostMapping("/page")
    public IPage<DataOriginalPageVO> page(@RequestBody DataOriginalPageDTO dataOriginalPageDTO) {
        return dataOriginalService.pageList(dataOriginalPageDTO);
    }


    @ApiOperation(value = "DataOriginal删除")
    @ApiOperationSupport(order = 5)
    @GetMapping("/delete")
    public void delete(Long id) {
        dataOriginalService.delete(id);
    }


    @ApiOperation(value = "DataOriginal批量删除")
    @ApiOperationSupport(order = 6)
    @PostMapping("/batchDelete")
    public void batchDelete(@RequestBody List<Long> ids) {
        dataOriginalService.batchDelete(ids);
    }


}

